package com.yang.lay.config;

import com.yang.lay.core.JwtPermission.ApiInterceptor;
import com.yang.lay.core.JwtPermission.SubjectUtil;
import com.yang.lay.core.auth.EtpCache;
import com.yang.lay.core.auth.UserRealm;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public  class ConfigReaml {
    @Bean
    public ApiInterceptor apiInterceptorBean(){

        ApiInterceptor apiInterceptor=new ApiInterceptor();
        apiInterceptor.setCache(etpCacheBean());
        apiInterceptor.setUserRealm(userRealmBean());
        return apiInterceptor;

    }
    @Bean(name = "userRealm")
    public UserRealm userRealmBean(){
        UserRealm userRealm=new UserRealm();
        return userRealm;
    }
    @Bean(name = "etpCache")
    public  EtpCache etpCacheBean(){
        return  new EtpCache();
    }


}
